package com.originskyseed.platform.user.service;

import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.originskyseed.platform.core.base.BasePage;
import com.originskyseed.platform.user.model.OrgGovernment;

/**
 * 行政区划表Service接口类（OSI_USER_ORG）
 * 
 * @author LiChengHuan
 */
public interface IOrgGovernmentService {

	/**
	 * 根据区域code查出关联的行政区列表
	 * 
	 * @param areaId
	 * @return
	 * @throws Exception
	 */
	public List<OrgGovernment> selectByAreaId(String areaId) throws Exception;

	/**
	 * 删除记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 * 
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(OrgGovernment record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public JSONObject insertSelective(OrgGovernment record) throws Exception;

	/**
	 * 更新记录
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(OrgGovernment record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public JSONObject updateByPrimaryKeySelective(OrgGovernment record) throws Exception;

	/**
	 * 查询记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public OrgGovernment selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询记录转为JSONObject
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public JSONObject selectJSONObjectById(String id) throws Exception;

	/**
	 * 查询列表
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<OrgGovernment> selectList(OrgGovernment record) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param countryCode
	 * @return
	 * @throws Exception
	 */
	public List<OrgGovernment> selectListByCountryCode(String countryCode) throws Exception;

	/**
	 * 分页查询列表
	 * 
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<OrgGovernment> selectListByPage(Map<String, Object> params, BasePage<OrgGovernment> page) throws Exception;

	/**
	 * 获取行政区划树
	 *
	 * @return
	 * @throws Exception
	 */
	public JSONArray selectUserOrgTree() throws Exception;

	/**
	 * 根据父code获取树
	 * 
	 * @param parentCode
	 * @return
	 * @throws Exception
	 */
	public JSONArray selectGovernmentByParentCode(String parentCode) throws Exception;

	/**
	 * 根据等级id获取树
	 * 
	 * @param levelId
	 * @return
	 * @throws Exception
	 */
	public JSONArray selectGovernmentByLevel(String levelId) throws Exception;

	/**
	 * 删除前判断是否存在下级
	 * 
	 * @param OrgGovernment
	 * @return
	 * @throws Exception
	 */
	public Boolean selectExitChild(OrgGovernment OrgGovernment) throws Exception;

	/**
	 * 判断编码是否存在
	 * 
	 * @param orgGovernment
	 * @return
	 * @throws Exception
	 */
	public Boolean existCode(OrgGovernment orgGovernment) throws Exception;

	/**
	 * 根据code查询对应的name
	 * 
	 * @param name
	 * @return
	 */
	String selectNameByCode(String name);
}